package com.springbootbooks.utils;



import java.util.regex.Matcher;
import java.util.regex.Pattern;

/** 
* @Description: 电话号码验证工具类 
* @Author: lijiafen
* @Date:  2021/10/29
* @Time: 21:15
* @eamil: 2368044269@qq.com
*/ 
public class FormatUtils {
    public static boolean isMobile(String str) {
        Pattern p = null;
        Matcher m = null;
        boolean b = false;
        // 验证手机号
       String s2 = "^[1](([3|5|8][\\d])|([4][4,5,6,7,8,9])|([6][2,5,6,7])|([7][^9])|([9][1,8,9]))[\\d]{8}$";
      if (str!=null){
          p = Pattern.compile(s2);
          m = p.matcher(str);
          b = m.matches();
      }
        return b;
    }
}

